using System;
using System.Collections;
using UnityEngine;

public class WWWFile
{
	public IEnumerator GetFile(string fileUrl)
	{
		fileUrl = Uri.EscapeUriString(fileUrl);
		WWW wdata = new WWW(fileUrl);
		yield return wdata;
		if (wdata.error != null)
		{
			UnityEngine.Debug.LogError(wdata.error);
			yield return null;
		}
		else
		{
			yield return wdata.textureNonReadable;
		}
		wdata.Dispose();
	}

	public IEnumerator GetString(string url)
	{
		url = Uri.EscapeUriString(url);
		WWW wdata = new WWW(url);
		yield return wdata;
		if (wdata.error != null)
		{
			UnityEngine.Debug.LogError(wdata.error);
			yield return null;
		}
		else
		{
			yield return wdata.text;
		}
		wdata.Dispose();
	}

	public IEnumerator GetString(string url, WWWForm form)
	{
		url = Uri.EscapeUriString(url);
		WWW wdata = new WWW(url, form);
		yield return wdata;
		if (wdata.error != null)
		{
			UnityEngine.Debug.LogError(wdata.error);
			yield return null;
		}
		else
		{
			yield return wdata.text;
		}
		wdata.Dispose();
	}
}
